Skip to content

fix: return None on browser pool acquire timeout - #192

Closed
Sayan- wants to merge 4 commits into
nextfrom
hypeship/fix-pool-acquire-204
Closed

Sayan- wants to merge 4 commits into
nextfrom
hypeship/fix-pool-acquire-204

Conversation

@Sayan-

@Sayan- Sayan- commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Make browser_pools.acquire() return None when the long poll ends with HTTP 204. The sync and async methods now declare an optional browser result, and only the acquire response model opts into mapping 204 to None. Explicit raw response parsing, other model endpoints, successful acquire, and 404 error behavior remain as before.

Validation

Added mock response tests for 200, 204, and 404, including sync, async, raw parse overrides, and strict validation of an unexpected 204 on another endpoint. The focused response suite passed (31 tests), and Pyright and Mypy passed.

The change was not exercised against a live pool.

The SDK's separate 60-second request timeout can still expire before a longer API poll reaches 204.

Generation and release

This custom SDK change targets next, the branch used for the versioned release PR. After that release reaches main, production changes must back-sync to SDK staging and the next stlc build must preserve this behavior. Merge the resulting custom-code tracking PR in the API configuration repo before relying on a later generation. The API's existing OpenAPI contract already documents the 200, 204, and 404 outcomes.


Note

Low Risk
Scoped, opt-in response parsing change for one endpoint; callers must handle optional acquire results, but other APIs and strict validation behavior for unrelated 204s are preserved.

Overview
browser_pools.acquire() now returns None when the long-poll ends with HTTP 204 (no browser available yet), instead of failing response parsing. Sync and async acquire are typed as Optional[BrowserPoolAcquireResponse].

A new opt-in marker NoContentAsNone is added; BrowserPoolAcquireResponse inherits it so the shared response parser maps 204 → None only for that model and only on default parse() (explicit parse(to=...) still returns empty body types as before). Other endpoints are unchanged—an unexpected 204 on e.g. retrieve still fails under strict validation.

Tests cover 200, 204, 404, async acquire, raw response parsing, and strict validation on a non-acquire route.

Reviewed by Cursor Bugbot for commit 25cdf95. Bugbot is set up for automated code reviews on this repo. Configure here.

@Sayan-
Sayan- marked this pull request as ready for review October 9, 2026 23:29
@Sayan-
Sayan- force-pushed the hypeship/fix-pool-acquire-204 branch from b789290 to 25cdf95 Compare October 10, 2026 00:00
@Sayan-
Sayan- changed the base branch from main to next October 10, 2026 00:00
@Sayan- Sayan- closed this Oct 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant